import { request } from "../untils/request.js";
import usersapi from "./users.js";
export default {
    // 渲染列表
    get: async ({ curPage = 1, eachPage = 10 } = {}) => {
        // const token = usersapi.getToken();
        return await request({
            type: "GET",
            url: "/api/schedules",
            data: { curPage, eachPage }
        })
    },
    // 新增排片
    create: data =>
        request({
            type: "POST",
            url: "/api/schedules/addSchedules",
            data: data
        }),
    // 删除排片 
    delete: _id =>
        request({
            url: `/api/schedules/delete/${_id}`,
            type: "DELETE",
        }),
    // 修改排片
    modify: data =>
        request({
            url: "/api/schedules/modify",
            type: "PUT",
            data: data,
        }),
    //  根据影院ID查询排片
    searchSchedules: cinemasId =>
        request({
            url: '/api/schedules/search',
            type: "get",
            data: { cinemasId }
        }),
    //  根据电影ID查询排片
    searchSchedulesMovies: movieId =>
        request({
            url: '/api/schedules/searchmovies',
            type: "get",
            data: { movieId }
        }),
    // 根据排片Id查排片
    searchscheId: _id =>
        request({
            url: '/api/schedules/searchscheId',
            type: "get",
            data: { _id }
        }),

    //根据排片id查询座位
    Seats: (schedules) =>
        request({
            url: '/api/schedules/Seats',
            type: "get",
            data: schedules
        }),

}
